home *** CD-ROM | disk | FTP | other *** search
/ Collection of Tools & Utilities / Collection of Tools and Utilities.iso / comm / superv22.zip / DUMBTERM.PAS < prev    next >
Pascal/Delphi Source File  |  1987-02-06  |  2KB  |  63 lines

  1. {                                 DUMBTERM
  2.          Plain vanilla comm program to demonstrate SUPERCOM.PAS
  3.  
  4.            (C) Copyright 1986, Doctor Debug/Steel City Software
  5.                             All Rights Reserved
  6.  
  7.       SUPER.COM must be loaded for this program to function correctly    
  8.  
  9. Do not run this program from the Turbo environment! Compile to a COM
  10. file first!
  11.  
  12.                         To exit program, type Ctrl-Z
  13. }
  14.  
  15. {$ISupercom.Pas}      {Bring in Comm library}
  16.  
  17. Var
  18.       x:LString; {255 byte string - defined in SUPERCOM library}
  19.       a,a1:char;
  20.       i,b,c:integer;
  21.       FilVar: Text;
  22.       FileName: String[14];
  23.       KeyCode: Byte;
  24.  
  25. {$iGetChar}   {Routine to Read Char from Keyboard}
  26.  
  27. Begin   {Main Program}
  28.    If not(SuperComPresent) then
  29.    Begin
  30.       Writeln ('Sorry, but SUPER.COM must be loaded in order to run Dumbterm.');
  31.       Halt;
  32.    End;
  33.    writeln ('Opening Supercom Port');
  34.    InitPort(1,1200,Even,7,1);    {opens port 1}
  35.    Writeln(Lst,'Port  opened');
  36.    ClearBuff;    {make sure buffer empty}
  37.    Writeln(Lst,'Buffer cleared');
  38.    FileName := 'TEXT.TXT';
  39.    Assign(FilVar,FileName);    {open file for capture}
  40.    Rewrite(FilVar);      {write from beginning}
  41.    a := ' ';
  42.    while a <> Chr(26)    {26 = end of file char}
  43.    Begin
  44.       if keypressed then  {this loop if key was pressed}
  45.       begin
  46.          a := GetChar;   {get keypress}
  47.          If a <> chr(26) then   {control Z? (signifies end)}
  48.             XmitCh(a);    {no, send character}
  49.       end;
  50.       c := rlen;    {# of chars in input buffer}
  51.       If c <> 0 then    {this loop if there are chars}
  52.       begin
  53.          if abs(c) > 255 then    {only get blocks of 255}
  54.             c := 255;
  55.          recblk(c,x);    {input data into x array}
  56.          Write(x);
  57.          Write(FilVar,x);
  58.       end;  {if}
  59.    end; {while}
  60.    Close(FilVar);     {close output file}
  61.    ClosePort;     {close Supercom port}
  62. end.     {Done!}
  63.